package c09泛型;

import java.awt.print.Printable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class 获取父类泛型的Class {
	public static void main(String[] args) {
		new T2().print();
	}
}

class T1<T, K> {
	protected Class clst;
	protected Class clsk;

	public T1() {
		ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass();
		Type[] types = type.getActualTypeArguments();
		clst = (Class) types[0];
		clsk = (Class) types[1];
	}
}

class T2 extends T1<Integer, String> {
	public void print() {
		System.err.println(clst);
		System.err.println(clsk);
	}
}